#ifndef __WORLD_SCENE_H__
#define __WORLD_SCENE_H__

#include "cocos2d.h"
#include "ccTypes.h"
#include "Box/PRFilledPolygon.h"
#include "cocos-ext.h"
#include "GameObject.h"

class WorldScene : public cocos2d::CCLayer
{
public:
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();
    
    // there's no 'id' in cpp, so we recommand to return the exactly class pointer
    static cocos2d::CCScene* scene();
    
    void startGame();
    void tick(float dt);
    void updateBackgroud(float dt);
    virtual void ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent);
    virtual void ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent);
    virtual void ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent);
    virtual void ccTouchesCancelled(CCSet *pTouches, CCEvent *pEvent);
    
    void enterLobbyCallback(CCObject* pSender);
    
    CREATE_FUNC(WorldScene);
    
private:
    void run();
    void jump();
    
    long getMillisecond();
    
    GameUser* user;
    
    double movingDist;
    long jumpTick;
};

#endif